<?php

class Kd_Validate {

    public function __construct() {}

    public static function isCharacter($value){
        $validate = new Kd_Validation_Rule_Character();
        return $validate->check($value);
    }

    public static function isNotEmpty($value){
        $validate = new Kd_Validation_Rule_NotEmpty();
        return $validate->check($value);
    }

    public static function isInteger($value){
        $validate = new Kd_Validation_Rule_Integer();
        return $validate->check($value);
    }

    public static function isDigit($value){
        $validate = new Kd_Validation_Rule_Digit();
        return $validate->check($value);
    }

    public static function isNumeric($value){
        $validate = new Kd_Validation_Rule_Numeric();
        return $validate->check($value);
    }

    public static function isEmail($value){
        $validate = new Kd_Validation_Rule_Email();
        return $validate->check($value);
    }

//    public static function testUrl($value){
//        $validate = new Kd_Validation_Rule_Url();
//        $result = $validate->check($value);
//        return self::buildResult($result, $message, $container);
//    }

    public static function isRegex($regex, $value){
        $validate = new Kd_Validation_Rule_Regex();
    	return $validate->setExpression($regex)
                    ->check($value);
    }

    public static function isMinValue($min, $value){
        $validate = new Kd_Validation_Rule_MinValue();
    	return $validate->setValue($min)
                    ->check($value);
    }

    public static function isMaxValue($max, $value){
        $validate = new Kd_Validation_Rule_MaxValue();
    	return $validate->setValue($max)
                    ->check($value);
    }

    public static function isRangeValue($min, $max, $value){
        $validate = new Kd_Validation_Rule_RangeValue();
    	return $validate->setMin($min)
                    ->setMax($max)
                    ->check($value);
    }

    public static function isMinLength($min, $value){
        $validate = new Kd_Validation_Rule_MinLength();
    	return $validate->setValue($min)
                    ->check($value);
    }

    public static function isMaxLength($max, $value){
        $validate = new Kd_Validation_Rule_MaxLength();
    	return $validate->setValue($max)
                    ->check($value);
    }

    public static function isRangeLength($min, $max, $value){
        $validate = new Kd_Validation_Rule_RangeLength();
    	return $validate->setMin($min)
                    ->setMax($max)
                    ->check($value);
    }
}